Add Cursor Agent and Gemini CLI hook integrations#10
Open
akeyx wants to merge 3 commits into
Open
Conversation
- Add cursor-rewrite subcommand for Cursor Agent PreToolUse hooks - Add gemini-rewrite subcommand for Gemini CLI BeforeTool hooks - Unify ztk init to auto-detect and install hooks for all supported agents (.claude/, .cursor/, .gemini/) present on the system - Add cursor.zig, cursor_init.zig, cursor_rewrite.zig, cursor_test.zig - Add gemini.zig, gemini_init.zig, gemini_init_build.zig, gemini_rewrite.zig, gemini_test.zig - 262 tests pass including 7 new Gemini-specific tests
- resolveSettingsPath: use 'catch return error.HomeNotSet' instead of 'try' for clearer error propagation when HOME is unset - readIfExists: discriminate FileNotFound from other errors instead of swallowing all errors as null
- Replace Claude Code-specific language with agent-agnostic framing - Document Cursor Agent and Gemini CLI as supported agents - Add supported agents table with hook mechanisms - Update test count from 231 to 269 - Clarify that ztk init detects and installs for all present agents
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds automatic interception support for Cursor Agent and Gemini CLI alongside the existing Claude Code hooks, making
ztka multi-agent compression layer.What changed
src/hooks/cursor*.zig) — installs aPreToolUsehook into.cursor/hooks.jsonthat invokesztk cursor-rewriteforrun_terminal_commandtool callssrc/hooks/gemini*.zig) — installs aBeforeToolhook into.gemini/settings.jsonthat invokesztk gemini-rewriteforrun_shell_commandtool callsztk init— detects which agent config directories exist (.claude/,.cursor/,.gemini/) and installs hooks only for those agents; errors if none are foundcursor-rewriteandgemini-rewritesubcommandsDesign decisions
claude_*pattern exactly (per-agentinit.zig,init_build.zig,rewrite.zig,test.zig, and a root module)claude_rewrite.extractCommandfor command parsing since the JSON shape is compatiblewriteAtomicfollows the direct-write pattern fromcursor_init.zigrather than temp+renamecatch return error.HomeNotSet,FileNotFounddiscrimination)Testing
All 269 tests pass (
zig build test). Manually verifiedztk init -gcorrectly detects and installs hooks for present agents only.